The exponential value of a number raised to a power is calculated using the formula: result = base ** exponent.
def calculate_exponential(base, exponent):
return base ** exponent
# Taking input for the base and exponent and calculating the exponential value
def calculate_and_display_exponential():
base = float(input("Enter the base: "))
exponent = float(input("Enter the exponent: "))
result = calculate_exponential(base, exponent)
print("Exponential value:", result)
calculate_and_display_exponential()
Enter the base: 2
Enter the exponent: 3
Exponential value: 8.0
Enter the base: 3
Enter the exponent: 4
Exponential value: 81.0
The function calculate_exponential(base, exponent)
calculates the exponential value of a number raised to a given power.
The function calculate_and_display_exponential()
takes input for the base and exponent, calculates the exponential value using the aforementioned function, and displays the result.